const fs = require("fs")
const path = require("path")
const Mock = require("mockjs")
const JSON5 = require("json5")
//读取文件
function getJsonFile (filepath) {
  var json = fs.readFileSync(path.resolve(__dirname, filepath), 'utf-8');
  return JSON5.parse(json);
}
//返回一个函数
module.exports = function (app) {
  app.get("/user/userinfo", function (req, res) {
    var json = getJsonFile("./userinfo.json5");
    res.json(Mock.mock(json))
  })
}